package com.snailct.bpp.db.mybatis.conf;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.persistence.EntityManager;


/**
 * Created by Administrator on 2016/9/9 0009.
 */
@Configuration
@ConditionalOnClass({EnableTransactionManagement.class, EntityManager.class})
@AutoConfigureAfter({DataBaseConfiguration.class})
@MapperScan(basePackages = {"com.snailct.**.mapper","com.snailct.**.dao","dbmap"})
public class MybatisConfiguration implements EnvironmentAware{
    private RelaxedPropertyResolver propertyResolver;

    public void setEnvironment(Environment environment) {
        propertyResolver = new RelaxedPropertyResolver(environment,"mybatis.");
    }

}
